﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Web.UI;
using System.Collections;

namespace Kevin.Controls
{
    [Serializable]
    [ToolboxItem(false)]
    [ToolboxData("<{0}:DataMethod runat=\"server\" />")]
    public class OperationMethod : WebControl
    {
        public OperationMethod() { }

        OperationMethod(DataBinder parent)
        {
            this._Binder = parent;
        }

        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public DataBinder Binder
        {
            get { return _Binder; }
            set { _Binder = value; }
        }
        private DataBinder _Binder = null;

        public string ButtonID
        {
            get;
            set;
        }

        public string Method
        {
            get;
            set;
        }
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        public ParameterCollection Parameters
        {
            get;
            set;
        }
    }

    public class OperationMethodCollection : CollectionBase
    {
        public int Add(OperationMethod item)
        {
           return base.List.Add(item);
        }

        public OperationMethod this[int index]
        {
            get { return (OperationMethod)base.List[index]; }
        }

        public bool Contains(OperationMethod item)
        {
            return base.List.Contains(item);
        }
    }
}
